package com.lihuinch.ti4j.chap6.demo;

import com.lihuinch.ti4j.chap6.demo2.DiffPacSonClass;

/**
 * 一个父类
 *
 * @author lihuinch
 * @date 2018/1/22
 */
public class FatherClass {
    void defaultFun() {
        System.out.println("father defaultFun");
    }

    protected void protectedFun() {
        System.out.println("father protectedFun");
    }

    public void publicFun() {
        System.out.println("father publicFun");
    }

    public static void main(String[] args) {
        FatherClass pointToDiff = new DiffPacSonClass();
        FatherClass pointToSame = new SamePacSonClass();

        pointToDiff.defaultFun();
        pointToDiff.publicFun();
        pointToDiff.protectedFun();

        pointToSame.defaultFun();
        pointToSame.publicFun();
        pointToSame.protectedFun();
    }
}

class SamePacSonClass extends  FatherClass {
    void defaultFun() {
        System.out.println("SamePacSonClass defaultFun");
    }
    protected void protectedFun() {
        System.out.println("SamePacSonClass protectedFun");
    }
    public void publicFun() {
        System.out.println("SamePacSonClass publicFun");
    }
}
